home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / moonstonemadness.swf / scripts / __Packages / Library / State.as < prev    next >
Text File  |  2007-09-27  |  2KB  |  82 lines

  1. class Library.State
  2. {
  3.    function State(__mcRef)
  4.    {
  5.       this.mcRef = __mcRef;
  6.       this.bStateLocked = false;
  7.       this.bPaused = false;
  8.    }
  9.    function doEnterFrame()
  10.    {
  11.       this["do" + this.sState]();
  12.    }
  13.    function doPause()
  14.    {
  15.       this.bPaused = true;
  16.       this.mcRef.mcState.stop();
  17.    }
  18.    function doResume()
  19.    {
  20.       this.bPaused = false;
  21.       this.mcRef.mcState.play();
  22.    }
  23.    function setState(__sState)
  24.    {
  25.       if(!this.bStateLocked)
  26.       {
  27.          this.doForcedSetState(__sState);
  28.       }
  29.    }
  30.    function doForcedSetState(__sState)
  31.    {
  32.       if(this.sState != __sState)
  33.       {
  34.          this.doUnLoadStateAction(this.sState);
  35.          this.sState = __sState;
  36.          this.mcRef.gotoAndStop(this.sState);
  37.          this.nStateTotalFrame = this.mcRef.mcState._totalframes;
  38.          this.doLoadStateAction(this.sState);
  39.       }
  40.    }
  41.    function get Paused()
  42.    {
  43.       return this.bPaused;
  44.    }
  45.    function get CurrentState()
  46.    {
  47.       return this.sState;
  48.    }
  49.    function doLoadStateAction()
  50.    {
  51.    }
  52.    function doUnLoadStateAction()
  53.    {
  54.    }
  55.    function doLockState()
  56.    {
  57.       this.bStateLocked = true;
  58.    }
  59.    function doUnlockState()
  60.    {
  61.       this.bStateLocked = false;
  62.    }
  63.    function isStateComplete()
  64.    {
  65.       var _loc2_ = false;
  66.       if(this.mcRef.mcState._currentframe == this.nStateTotalFrame)
  67.       {
  68.          _loc2_ = true;
  69.       }
  70.       return _loc2_;
  71.    }
  72.    function isStateStarting()
  73.    {
  74.       var _loc2_ = false;
  75.       if(this.mcRef.mcState._currentframe == 1)
  76.       {
  77.          _loc2_ = true;
  78.       }
  79.       return _loc2_;
  80.    }
  81. }
  82.